/*******************************************************************/
/* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        */
/*                                                                 */
/*  NAME      = t__wtc_destroy_session.c                          */
/*  NOTE      =                                                    */
/*  DATE      = 2016/02/24 by songbb                               */
/*******************************************************************/

#include <CUnit/Basic.h>
#include <stdlib.h>

#include "frcomm.h"
#include "frmem.h"

#include "../../../src/module/tuxedowtc/config.h"
#include "../test_wtc_comm.h"
#include <tuxedowtc/wtc_core.h>
#include <tuxedowtc/wtc_header.h>
#include <tuxedowtc/wtc_comm.h>
#include <tuxedowtc/wtc_packet.h>
#include <frct_comm.h>

extern void __wtc_destroy_session(L7session_wtc **pp_st_session);

static int __suite_init(void)
{
    return 0;
}

static int __suite_cleanup(void)
{
    return 0;
}

static void __case1(void)
{
    L7session_wtc *p_st_wtc_sess = NULL;
    p_st_wtc_sess = (L7session_wtc *) frmalloc(sizeof(L7session_wtc));
    CU_ASSERT_PTR_NOT_NULL(p_st_wtc_sess);
    memset(p_st_wtc_sess, 0x00, sizeof(L7session_wtc));

    __wtc_destroy_session(&p_st_wtc_sess);
    CU_ASSERT_PTR_NULL(p_st_wtc_sess);
}

static void __case2(void)
{
    L7session_wtc *p_st_wtc_sess = NULL;
    __wtc_destroy_session(&p_st_wtc_sess);
    CU_ASSERT_PTR_NULL(p_st_wtc_sess);
}

int add_suite__wtc_destroy_session(void)
{
    CU_pSuite pSuite = NULL;

    if ((pSuite = CU_add_suite(MODULE_NAME" __wtc_destroy_session()", __suite_init, __suite_cleanup)) == NULL)
        return FR_FAIL;

    if (CU_add_test(pSuite, "case1", __case1) == NULL ||
        CU_add_test(pSuite, "case2", __case2) == NULL)
        return FR_FAIL;

    return FR_SUCC;
}
